import { createRequest } from '../config/axios.config';

const baseUrl = {
    local: 'https://teacherclass-dev.3ren.cn',
    dev: 'https://teacherclass-dev.3ren.cn',
    qa: 'https://teacherclass-qa.3ren.cn',
    production: 'https://teacherclass.3ren.cn',
};

type Environment = keyof typeof baseUrl;
const env = (process.env.APP_DEPLOY_ENV as Environment) || 'local';

/**
 * 查询统计数据
 */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const ClientLogsMonitorGet = createRequest<any, any>('ClientLogsMonitorGet', ({ type }) => ({
    url: `${baseUrl[env]}/srtclass/logs/client_logs/monitor`,
    method: 'GET',
    params: {
        type,
    },
}));

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const FailListGet = createRequest<any, any>(
    'FailListGet',
    ({ page_size, page_num, user_name, file_name }) => ({
        url: `${baseUrl[env]}/srtclass/logs/client_logs/get_fail_list`,
        method: 'GET',
        params: {
            page_size,
            page_num,
            user_name,
            file_name,
        },
    }),
);

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const ClientLogsExcelExport = createRequest<any, any>(
    'ClientLogsExcelExport',
    ({ user_name, file_name }) => ({
        url: `${baseUrl[env]}/srtclass/logs/client_logs/excel`,
        method: 'GET',
        params: {
            user_name,
            file_name,
        },
    }),
);
